package com.qf.mapper;

import com.qf.entity.MallGoodsCatEntity;
import com.qf.views.ViewCatTplEntity;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface CatMapper {
    @Select("select * from view_cat_tpl where parent_id=#{pid}")
    List<ViewCatTplEntity> findById(String pid);

    @Select("select * from view_cat_tpl")
    List<ViewCatTplEntity> findAll();

    @Insert("insert into mall_goods_cat (parent_id,name,template_id) values(#{parentId},#{name},#{templateId})")
    int add(MallGoodsCatEntity entity);

    @Update("update mall_goods_cat set parent_id=#{parentId},name=#{name},template_id=#{templateId} where id=#{id}")
    int update(MallGoodsCatEntity entity);

}
